<?
include("/var/www/html/new/d/common/header.html");
include("/var/www/html/new/d/common/left.html");
include("/var/www/html/new/d/common/page.php");

//-------------------------------------------------------------
$method = 1;
include("/var/www/html/new/d/module/wxh/common/billcommon_r.php");
//-------------------------------------------------------------
$memberID = $_SESSION['sid'];
$statusT=array("0"=>"<em class='red'>未结算</em>",1=>"<em class='orange'>结算中</em>",2=>"<em class='green'>已结算</em>");
$r=array();
$status=array();
$where="where aid=$memberID and orders<>0";

$sDate = $_REQUEST['btime'] ? $_REQUEST['btime']:date('Y-1-1');
$eDate = $_REQUEST['etime'] ? $_REQUEST['etime']:date('Y-08-31');
$where.=" and etime>='".$sDate." 00:00:00'";
$where.=" and etime<='".$eDate." 23:59:59'";
if(isset($_REQUEST['status'])){
    $status=$_REQUEST['status'];
    $where.=" and status in (".implode(",",$status).")";
}
if($_GET['fid']){
    $fid = $_GET['fid']+0;
    $where .= "and fid=$fid ";
}
$pageSize = $_REQUEST['pageSize'] ? $_REQUEST['pageSize']:15;
$currentPage = $_REQUEST['currentPage'] ? $_REQUEST['currentPage']:1;
$start = ($currentPage-1) * $pageSize;
$limit = " limit 10";
$str="select id,aid,fid,btime,orders,tnums,money,etime,status from uu_bill $where order by id desc $limit ";

$GLOBALS['le']->query($str);
while($row=$GLOBALS['le']->fetch_assoc()){
    $r[]=$row;
}
$str="select count(*) as num from uu_bill $where";
$GLOBALS['le']->query($str);
$GLOBALS['le']->fetch_assoc();
$count=$GLOBALS['le']->f("num");

$h3Title="应收款账单";
$about="get";
foreach($r as $k => $v){
    if(!$dnames[$v['fid']]){
        $sql = "select dname from pft_member where id={$v['fid']} limit 1";
        $GLOBALS['le']->query($sql);
        $GLOBALS['le']->fetch_assoc();
        $dnames[$v['fid']] = $GLOBALS['le']->f('dname');
    }
}

//$obj=simplexml_load_string(
//        $s->Order_Globle_Search("","","","","","","","","","",$sDate,$eDate,"","","","1|6","","","",1,0,99999,"0","0","","0","","0","","",$r[0]['aid'],0,"","","",""));
//foreach($obj as $obj_key =>$obj_val)
//{
//    if((int)$obj_val->UUaids==0)
//        continue;
//    elseif((int)$obj_val->UUaids!=0)
//    {
//       echo '<pre>';
//       print_r(unserialize($obj_val->UUaids_money));
//       echo '</pre>';unserialize($obj_val->UUaids_money);
//    }
//}

include("tpl/bill.tpl");
include("/var/www/html/new/d/common/footer.html");
?>